//
//  YYT_item1TableViewCell.m
//  AudioVisualFeast
//
//  Created by dllo on 16/2/29.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "QL_item1TableViewCell.h"
#import <UIImageView+WebCache.h>


@implementation QL_item1TableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.pic = [[UIImageView alloc]initWithFrame:CGRectZero];
        [self addSubview:self.pic];
        
        self.title = [[UILabel alloc] initWithFrame:CGRectZero];
        _title.font = [UIFont systemFontOfSize:11];
        [self addSubview:self.title];
        
        self.descriptions = [[UILabel alloc] initWithFrame:CGRectZero];
        _descriptions.textColor = [UIColor colorWithRed:30 / 255.0 green:195 / 255.0 blue:153 / 255.0 alpha:1.0];
        _descriptions.font = [UIFont systemFontOfSize:11];
        [self addSubview:self.descriptions];
        
        self.totalViews = [[UILabel alloc] initWithFrame:CGRectZero];
        _totalViews.font = [UIFont systemFontOfSize:9];
        [self addSubview:self.totalViews];
        
    }
    return self;
}

- (void)layoutSubviews {
    self.pic.frame = CGRectMake(0, 0, 150, 80);
    self.title.frame = CGRectMake(self.pic.bounds.size.width + 10, 20, self.frame.size.width - 100, 20);
    self.descriptions.frame = CGRectMake(self.pic.bounds.size.width + 10 , 40, self.frame.size.width - 50, 20);
    self.totalViews.frame = CGRectMake(self.pic.bounds.size.width + 10 , 60 , self.frame.size.width - 50, 20);
}

- (void)setModel:(QL_ModleShared *)model {
    _model = model;
    
    [self.pic sd_setImageWithURL:[NSURL URLWithString:_model.albumImg]];
    self.title.text = _model.title;
    self.descriptions.text = _model.artistName;
    self.totalViews.text = [NSString stringWithFormat:@"播放次数：%@", _model.totalViews];
}

@end
